#@PydevCodeAnalysisIgnore
'''
Created on 21-07-2013

@author: Lukasz Rytel
'''

import numpy.random as npr
from utils.utils_functions import factorial

class Graph_properties(object):
    '''
    Class which consists with parameters which are describing graph structure.
    '''

    def __init__(self,nodes=None,edges=None,direction=None,recurention=None,label=None):
        self.label = label
        if recurention is None:
            self.recurention = False
        else:
            self.recurention = True
        #########
        if type(direction) == type(""):
            direction = direction.lower()
        if direction is None or direction == "off" or direction == False:
            self.direction = False
        else:
            self.direction = True
        #########
        if nodes is None:
            min_nodes = 1
            max_nodes = 6
            self.nodes = npr.random_integers(min_nodes, max_nodes)
        else:
            self.nodes = nodes
        #########
        if edges is None:
            self.edges = npr.random_integers(1,factorial(self.nodes))
        else:
            self.edges = edges
        
                
    def print_parameters(self):
        label = ""
        if self.label is not None:
            label = "Graph {0}: ".format(self.label)
        print "{0}Nodes = {1}, Edges = {2}, Directions = {3}, Recurention = {4}".format(label, self.nodes, self.edges, self.direction, self.recurention)
        
